Skip to content

[SPARK-56115] Support crds.install in Helm Chart#641

Closed
TQJADE wants to merge 4 commits into
apache:mainfrom
TQJADE:crd
Closed

[SPARK-56115] Support crds.install in Helm Chart#641
TQJADE wants to merge 4 commits into
apache:mainfrom
TQJADE:crd

Conversation

@TQJADE
Copy link
Copy Markdown
Contributor

@TQJADE TQJADE commented Apr 22, 2026

What changes were proposed in this pull request?

This PR introduces a crds.install configuration option to the Helm chart. CRD files are moved from the crds/ directory
(unconditionally installed by Helm) to templates/crds/ with a {{- if .Values.crds.install }} guard, allowing users to
disable CRD installation by setting crds.install: false. Similar to:
https://github.com/argoproj/argo-helm/blob/f7aee451eb788abd682d187fb055668bbfe28091/charts/argo-cd/values.yaml#L31-L40

Why are the changes needed?

In environments where CRDs are managed separately, users need the ability to skip CRD installation at the chart level. Previously the only option was the helm install --skip-crds flag, which is not declarative and cannot be expressed in a values file.

Does this PR introduce any user-facing change?

Yes.

  • crds.install (default: true) — Controls whether CRDs are installed with the chart. Set to false when CRDs are managed externally or when deploying a second operator instance.
  • crds.annotations (default: {"helm.sh/resource-policy": "keep"}) — Annotations applied to CRD resources. The default prevents CRDs from being deleted on helm uninstall.
  • Migration note: Users running multiple operator releases in different namespaces must set crds.install: false on
    releases.

How was this patch tested?

helm template --set crds.install=true renders both CRDs
helm template --set crds.install=false renders no CRDs                                                                    

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

@TQJADE TQJADE changed the title Introduce crds.install to Helm Chart [SPARK-56115] Introduce crds.install to Helm Chart Apr 22, 2026
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-56115] Introduce crds.install to Helm Chart [SPARK-56115] Support crds.install in Helm Chart Apr 22, 2026
Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this PR is safe because templates/crds seems to be not protected during uninstallation. Could you double-check the CRD remains in the system during helm uninstall operation like before?

Does this PR introduce any user-facing change?

No

doLast {
def generatedCRDFileBase = "$currentPath/build/resources/main/"
def stagedCRDFileBase = "$currentPath/../build-tools/helm/spark-kubernetes-operator/crds/"
def stagedCRDFileBase = "$currentPath/../build-tools/helm/spark-kubernetes-operator/templates/crds/"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe?

@dongjoon-hyun
Copy link
Copy Markdown
Member

Why do we need to change spark-operator-api/build.gradle in this PR which adds crds.install?

@TQJADE
Copy link
Copy Markdown
Contributor Author

TQJADE commented Apr 23, 2026

I'm not sure if this PR is safe because templates/crds seems to be not protected during uninstallation. Could you double-check the CRD remains in the system during helm uninstall operation like before?

Does this PR introduce any user-facing change?

No

Thanks for catching this! The move from crds/ to templates/crds/ did lose Helm's built-in uninstall protection. I've addressed this by adding a configurable crds.annotations value, defaulting to "helm.sh/resource-policy": keep, which tells Helm to skip deleting CRDs on uninstall.

@TQJADE
Copy link
Copy Markdown
Contributor Author

TQJADE commented Apr 23, 2026

Why do we need to change spark-operator-api/build.gradle in this PR which adds crds.install?

  1. The compared base file path change: The CRD files were moved from crds/ to templates/crds/
  2. Crd contents contains the {{- if .Values.crds.install }} etc, yq cmd will failed with sed

@TQJADE TQJADE requested a review from dongjoon-hyun April 23, 2026 16:32
@dongjoon-hyun
Copy link
Copy Markdown
Member

dongjoon-hyun commented Apr 24, 2026

Could you check the CI failures because it fails 3 times consistently in our CI? Does it pass locally?

Screenshot 2026-04-24 at 15 40 59

@TQJADE
Copy link
Copy Markdown
Contributor Author

TQJADE commented Apr 25, 2026

Could you check the CI failures because it fails 3 times consistently in our CI? Does it pass locally?

Screenshot 2026-04-24 at 15 40 59

Fix by commit: 4bfbb74

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if you verify helm upgrade manually, too?

@TQJADE
Copy link
Copy Markdown
Contributor Author

TQJADE commented Apr 29, 2026

I'm wondering if you verify helm upgrade manually, too?

Thanks for pointing this out. Yes, upgrade will failed without labeling and annotations. Adding doc: 3825979#diff-ad74991b96593fdee570962fc5b1e319080abd55e16614f556f74b7de8fd02d1R161

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @TQJADE . Thank you for all your efforts and passion.

Given the current context, the potential side effects of this PR seem quite complex. Since we haven't had sufficient time to fully verify them, moving forward right now feels a bit risky. There's a concern that this might inadvertently lock us into supporting custom CRDs indefinitely, whereas the Apache Spark community is aiming for a more homogeneous infrastructure based on standard, community-blessed CRDs.

Therefore, I'd suggest we focus on releasing v1.0 without this feature for now, and then revisit this topic carefully for v2.0 once we've had time for more comprehensive testing.

@TQJADE TQJADE closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants